package org.clockworkmages.games.anno1186.model.character;

import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;

import org.clockworkmages.games.anno1186.model.GameObject;
import org.clockworkmages.games.anno1186.model.effect.Effect;

public class Skill
		extends GameObject {

	private String name;

	private List<Effect> effects = new ArrayList<Effect>();

	/**
	 * Stats that are taken into consideration when calculating the chance of
	 * the use of thiss skill to succeed.
	 */
	private List<String> rulingStats = new ArrayList<String>();

	/**
	 * Number by which the value of ruling stats is multiplied when adding it to
	 * the calculation of skill tests's success chance. By default equals one
	 * for common skills (Speech, Survival), but can be less for skills that
	 * require expertise specific (lockpicking, theology).
	 */
	private double statModifier = 1;

	public Skill() {

	}

	public Skill(String id, String name, double statModifier,
			String... rulingStatIds) {
		this(id, name, rulingStatIds);
		this.statModifier = statModifier;
	}

	public Skill(String id, String name, String... rulingStatIds) {
		super(id);
		this.name = name;
		for (String statId : rulingStatIds) {
			this.rulingStats.add(statId);
		}
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@XmlElement(name = "effect")
	public List<Effect> getEffects() {
		return effects;
	}

	public void setEffects(List<Effect> effects) {
		this.effects = effects;
	}

	@XmlElement(name = "stats")
	public List<String> getRulingStats() {
		return rulingStats;
	}

	public void setRulingStats(List<String> rulingStats) {
		this.rulingStats = rulingStats;
	}

	@XmlAttribute(name = "statModifier")
	public double getStatModifier() {
		return statModifier;
	}

	public void setStatModifier(double statModifie) {
		this.statModifier = statModifie;
	}

}
